<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      .box {
        width: 6.9rem;
        height: 3rem;
        margin: 0.3rem;
        background-color: skyblue;
      }
    </style>
  </head>
  <body>
    <div class="box"></div>
    <script>
      // rem适配方式一:
      // 1. 动态计算当前设备根标签的字体大小
      // 设备独立像素的宽度 * 100 / 设计稿的宽度
      const fontSize = (document.documentElement.clientWidth * 100) / 750
      // 2. 给根标签赋值
      document.documentElement.style.fontSize = fontSize + 'px'
    </script>
  </body>
</html>
